// isNaN([val])
// console.log(isNaN(10));
// console.log(isNaN("AA"));
// console.log(isNaN("10"));
/*
  Number('10) =>10
  isNaN(10) => false
*/

// console.log(Number('13.5'));
// console.log(Number('12.5px'));
// console.log(Number('jj12.5'));
// console.log(Number('12.5.5'));
// console.log(Number(''));

// console.log(Number(true)); // 1
// console.log(Number(false)); // 0

// console.log(Number(null));
// console.log(Number(undefined));

// 把引用数据类型转换为数字, 是先把他基于toString()方法转换为字符串, 然后再转换为数字
/* console.log(Number({ name: "XXC" })); // NaN
console.log(Number({})); // NaN
console.log(Number([])); // 0
// [].toString() => ""
console.log(Number([12])); // 12
// [].toString() => "12"
console.log(Number([12, 23])); // NaN
// [].toString() => "12, 23" */

// let str = '12.5px';
// console.log(Number(str));
// console.log(parseInt(str));
// console.log(parseFloat(str));
// console.log(Number(null));
// console.log(Number(undefined));

/* console.log(parseInt("10", 2));
console.log(parseInt('10', 8));
console.log(parseInt('10', 10));
console.log(parseInt('10', 16)); */

console.log(parseFloat("123456blue")); // 123456
console.log(parseFloat('0xA')); // 0
console.log(parseFloat("22.5")); //22.5
console.log(parseFloat('0985.0')); // 985
console.log(parseFloat('3.125e7')); // 31250000
